/*******************************************************************************
  * @file                   common.h
  * @Author:                MQjehovah                 mail:MQjehovah@hotmail.com
  * @version                1.0.0
  * @date                   2017-12-22 15:30:18
  * @brief                  
  ******************************************************************************
  * @attention
*******************************************************************************/
#ifndef __COMMON_H
#define __COMMON_H
/* Includes ------------------------------------------------------------------*/
#include "BSP.h"
/* Definition ----------------------------------------------------------------*/
#define IS_AF(c) ((c >= 'A') && (c <= 'F'))
#define IS_af(c) ((c >= 'a') && (c <= 'f'))
#define IS_09(c) ((c >= '0') && (c <= '9'))
#define ISVALIDHEX(c) IS_AF(c) || IS_af(c) || IS_09(c)
#define ISVALIDDEC(c) IS_09(c)
#define CONVERTDEC(c) (c - '0')

#define CONVERTHEX_alpha(c) (IS_AF(c) ? (c - 'A' + 10) : (c - 'a' + 10))
#define CONVERTHEX(c) (IS_09(c) ? (c - '0') : CONVERTHEX_alpha(c))

/* Exported Functions --------------------------------------------------------*/
void Int2Str(uint8_t *str, int32_t intnum);
uint32_t Str2Int(uint8_t *inputstr, int32_t *intnum);
#endif
/*********************************END OF FILE**********************************/
